package wang.snalc.jpanewdemon.specification_new;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Set;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SearchCriteria {
    private String key;
    private String operation;
    private Object value;
    private Boolean isOr;
    private Set<SearchCriteria> searchCriteriaSet;
    private boolean isJoin;
    private String[] joinTable;

    public SearchCriteria(String key, String operation, Object value, String[] joinTable) {
        this.key = key;
        this.operation = operation;
        this.value = value;
        if (joinTable != null) {
            this.joinTable = joinTable;
            this.isJoin = true;
        }
    }

    public SearchCriteria(Set<SearchCriteria> searchCriteriaSet, Boolean isOr) {
        this.searchCriteriaSet = searchCriteriaSet;
        this.isOr = isOr;
    }
}
